
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
	
	<!-- END RIBBON -->
	<div class="content">
		<div class="panel panel-default panel-intro">
			<div class="panel-heading">
				<div class="panel-lead">
					<em>管理员列表</em>
                    ...
				</div>
			</div>
			<div class="panel-body">
				<div id="myTabContent" class="tab-content">
					<div class="tab-pane fade active in" id="one">
						<div class="widget-body no-padding">
							<div class="bootstrap-table">
								
								<div class="fixed-table-toolbar">
									<div class="bs-bars pull-left">
										<div id="toolbar" class="toolbar">
											<a href="javascript:window.location.reload();" class="btn btn-primary btn-refresh" title="刷新">
												<i class="fa fa-refresh"></i>
											</a>
											{if condition="$adminController->vif('manager','add')"}
											<a href="javascript:add('add');" class="btn btn-success btn-add" title="添加"><i class="fa fa-plus"></i> 添加</a>
											{/if}
										</div>
									</div>
									<div class="columns columns-right btn-group pull-right">
										
                                        <button class="btn btn-default clickTab" type="button" name="toggle" aria-label="toggle" title="搜索菜单">
											<i class="glyphicon glyphicon-list-alt icon-list-alt"></i>
										</button>
										<div class="keep-open btn-group" title="列">
											<button type="button" aria-label="columns" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
												<i class="glyphicon glyphicon-th icon-th"></i>
												<span class="caret"></span>
											</button>
                      						<ul class="dropdown-menu" id="table_menu">
												
											</ul>
										</div>
                                        
									</div>
								</div>
								<div class="fixed-table-container" style="padding-bottom: 0px;">
									<div class="fixed-table-body">
										<table id="table" class="table table-striped table-bordered table-hover" width="100%">
											<thead>
												<tr>
													<th data-status="0" width="50"><div class="th-inner">ID</div></th>
													<th data-status="1" width="120"><div class="th-inner">用户名</div></th>
													<th data-status="1" width="120"><div class="th-inner">姓名</div></th>
													<th data-status="1" width="120"><div class="th-inner">手机</div></th>
													<th data-status="1" width=""><div class="th-inner">部门-岗位</div></th>
													<th data-status="1" width="80"><div class="th-inner">在职</div></th>
													<th data-status="1" width="80"><div class="th-inner">状态</div></th>
													<th data-status="1" width=""><div class="th-inner">权限</div></th>
													<th data-status="1" width=""><div class="th-inner">管辖区域</div></th>
                                                    <th data-status="1" width="170"><div class="th-inner">添加时间</div></th>
													<th data-status="1" width="120"><div class="th-inner">操作</div></th>
												</tr>
											</thead>
                                            
											<tbody id="content-main">

												{foreach name="list" item="v"}
												<tr class="del-{$v.m_id}">
													<td align="center">{$v.m_id}</td>
													<td align="center">{$v.m_user}</td>
													<td align="center">{$v.m_nice}</td>
													<td align="center">{$v.m_phone}</td>
													<td align="center">
														{$v.s_name|default='无'}-{$v.j_name|default='无'}
													</td>
													<td align="center">
														{switch name="v.m_existence"}
															{case value='2'}<font color="red">离职</font>{/case}
															{case value='1'}在职{/case}
														{/switch}
													</td>
													<td align="center">
														{switch name="v.m_status"}
															{case value='2'}<font color="red">禁用</font>{/case}
															{case value='1'}开启{/case}
														{/switch}
													</td>
													<td align="center">
														{switch name="v.m_type"}
															{case value='2'}普通管理员{/case}
															{case value='1'}<font color="red">超级管理员</font>{/case}
														{/switch}
													</td>
													<td align="center">
														{if condition="$v.m_nationwide == 1"}
															全国
														{else /}
															局部
														{/if}
													</td>
													<td align="center">{$v.m_time|date="Y-m-d H:i:s",###}</td>
													<td style="text-align: center; vertical-align: middle; ">
														{if condition="$adminController->vif('manager','details')"}
														<a href="javascript:details('{:url('manager/details', ['pid'=>$v['m_id']])}');" class="btn btn-xs btn-info" title="预览">
															<i class="fa fa-hand-scissors-o"></i>
														</a>
														{/if}
														{if condition="$adminController->vif('manager','upd')"}
														<a href="javascript:upd('{:url('manager/upd', ['pid'=>$v['m_id']])}');" class="btn btn-xs btn-success btn-editone" title="编辑">
                                                            <i class="fa fa-pencil"></i>
														</a>
														{/if}
														{if condition="$adminController->vif('manager','del')"}
														<button data-id="{$v.m_id}" onclick="return del_admin(this)" class="btn btn-xs btn-danger btn-delone del_menu" title="删除">
															<i class="fa fa-trash"></i>
														</button>
														{/if}
													</td>
												</tr>
												{/foreach}
											</tbody>
										</table>
									</div>
									<div class="fixed-table-pagination" style="display: block;">
										<div class="pull-left pagination-detail">
											{$page}
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>


<!--多功能面板--> 
<div id="divTab" class="divTab">
    <!--固定头部-->
    <div class="jzy_tab_top">
        <img src="__ADMIN__/images/gongneng.png" class="lt">
        <div class="txt lt">功能面板</div>
        <div class="on rt" id="onTab">×</div>
    </div>
    
    <div class="jzy_tab_main">
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;"><legend>搜索条件</legend></fieldset>
        <form class="layui-form" action="">
            <div class="layui-form-item">
                <div class="layui-inline">
                <label class="layui-form-label">姓名</label>
                <div class="layui-input-inline">
					<input type="text" class="form-control" name="nice" value="{$page_where.nice}">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                <label class="layui-form-label">用户名</label>
                <div class="layui-input-inline">
                    <input type="text" class="form-control" name="user" value="{$page_where.user}">
                </div>
			</div>
			<div class="layui-form-item">
				<div class="layui-inline">
				<label class="layui-form-label">手机号</label>
				<div class="layui-input-inline">
					<input type="text" class="form-control" name="phone" value="{$page_where.phone}">
				</div>
			</div>
			<div class="layui-form-item">
				<div class="layui-inline">
				<label class="layui-form-label">在职</label>
				<div class="layui-input-inline">
					<select class="js_company_select form-control" name="existence">
						<option value="">全部</option>
						<option value="1" {eq name="page_where.existence" value="1"}selected{/eq}>在职</option>
						<option value="2" {eq name="page_where.existence" value="2"}selected{/eq}>离职</option>
					</select>
				</div>
			</div>
			<div class="layui-form-item">
				<div class="layui-inline">
				<label class="layui-form-label">状态</label>
				<div class="layui-input-inline">
					<select class="js_company_select form-control" name="status">
						<option value="">全部</option>
						<option value="1" {eq name="page_where.status" value="1"}selected{/eq}>启用</option>
						<option value="2" {eq name="page_where.status" value="2"}selected{/eq}>禁用</option>
					</select>
				</div>
			</div>
           
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn layui-btn-sm layui-btn-normal">搜索</button>
                </div>
            </div>
        </form>
    </div>
</div>
<script>
layui.use(['form'], function(){
  var form = layui.form;
});

// 删除
function del_admin(_this) {
	if (confirm('确认删除吗')) {
        var id   = $(_this).attr('data-id');
        var data = {'id':id};

        $.ajax({
            type: 'post',
            data:data,
            url: "{:url('del')}",
            success: function(data) {
                var array = eval('('+data+')');
				if (array['code'] == '01') {
					$.thinkmimi({Content : array['msg'], Type:2, Align:'right', OutTime:2000});
				} else {
					$.thinkmimi({Content : array['msg'], Type:1, Align:'right', OutTime:2000});
					$('.del-'+id).remove();
				}
            }
        });
    }
}
// 预览
function details(href) {
	layer.open({
		type: 2,
		title: '预览管理员详情',
		shadeClose: true,
		shade: false,
		maxmin: true,
		area: ['600px', '670px'],
		content: href
	});
}
// 添加
function add(href) {
	layer.open({
		type: 2,
		title: '添加新管理员',
		shadeClose: true,
		shade: false,
		maxmin: true,
		area: ['100%', '100%'],
		btn: ['确认', '取消'],
		content: href,
		yes: function(index, layero) {
			var _this = layero.find('iframe')[0];
			var bool  = _this.contentWindow.doSubimt();
			if (bool !== false) {
				$.thinkmimi({Content : bool['msg'],Type : 1,Align:'right',OutTime:2000,});
				menu_run();
				layer.closeAll();
				window.setTimeout(function(){
					window.location.reload();
				}, 700);
			}
		},
	});
}
// 修改
function upd(href) {
	layer.open({
		type: 2,
		title: '修改管理员',
		shadeClose: true,
		shade: false,
		maxmin: true,
		area: ['100%', '100%'],
		btn: ['确认', '取消'],
		content: href,
		yes: function(index, layero) {
			var _this = layero.find('iframe')[0];
			var bool  = _this.contentWindow.doSubimt();
			if (bool !== false) {
				$.thinkmimi({Content : bool['msg'],Type : 1,Align:'right',OutTime:2000,});
				menu_run();
				layer.closeAll();
				window.setTimeout(function(){
					window.location.reload();
				}, 700);
			}
		},
	});
}
</script>
